#!/bin/bash
src_ctl="./ctl/build/orcafs-ctl"
dest_ctl="/usr/bin/orcafs-ctl"

if (($# == 0));then
	echo "Uasge: sh $0 <96.100> <96.101> <...>"
	exit
fi

if [ ! -e ${src_ctl} ];then
    echo "file(${src_ctl}) is not exist"
	echo "Uasge: sh $0 <96.100>"
	exit
fi

function update_ctl()
{
	echo -----copyTo--------"${node}"----"${src_ctl}"-------
    version=$(date "+%Y%m%d%H%M")
    eval sshpass -p 'p@ssword' ssh root@192.168."${node}" 'cp /usr/bin/orcafs-ctl /tmp/orcafs-ctl-${version}'
    sshpass -p 'p@ssword' scp ${src_ctl} root@192.168."${node}":${dest_ctl}
}

for node in "$@"
do
	update_ctl
done
